var t = require;
var e = module;
var o = exports;
var n =
    (this && this.__extends) ||
    (function() {
        var t = function(e, o) {
            return (t =
                Object.setPrototypeOf ||
                ({ __proto__: [] }
                    instanceof Array &&
                    function(t, e) {
                        t.__proto__ = e;
                    }) ||
                function(t, e) {
                    for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                })(e, o);
        };
        return function(e, o) {
            function n() {
                this.constructor = e;
            }
            t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
        };
    })(),
    r =
    (this && this.__decorate) ||
    function(t, e, o, n) {
        var r,
            a = arguments.length,
            i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
        else
            for (var s = t.length - 1; s >= 0; s--)
                (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
        return a > 3 && i && Object.defineProperty(e, o, i), i;
    };
Object.defineProperty(o, "__esModule", { value: !0 });
var a = t("BootConst"),
    i = t("EventData"),
    s = t("GameData"),
    c = t("Util"),
    l = t("View"),
    u = t("WatchVideo"),
    p = t("ConfS"),
    f = require("./送金刚领取"),
    d = cc._decorator,
    h = d.ccclass,
    y =
    (d.property,
        (function(t) {
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                return (
                    (e.res = "送金刚"),
                    (e.zIndex = 5),
                    (e.isMask = !0),
                    (e.倒计时 = new i.default(0)),
                    (e.装备1 = new i.default(null)),
                    (e.装备2 = new i.default(null)),
                    (e.装备3 = new i.default(null)),
                    e
                );
            }
            return (
                n(e, t),
                (e.prototype.view_倒计时 = function(t, e) {
                    var o = Date.now() - e,
                        n = 1e3 * p.DatasManager.金刚礼包时长 - o;
                    t.string = c.timeToString(n) + "后消失";
                }),
                (e.prototype.view_装备1 = function(t, e) {
                    t.url.value = e;
                }),
                (e.prototype.view_装备2 = function(t, e) {
                    t.url.value = e;
                }),
                (e.prototype.view_装备3 = function(t, e) {
                    t.url.value = e;
                }),
                (e.prototype.view_送金刚广告次数 = function(t, e) {
                    t.string = "成功观看2次广告后可获得 (" + e + "/" + p.DatasManager.金刚礼包看视频次数 + ")";
                }),
                (e.prototype.onEnable = function() {
                    var t = this;
                    (this.倒计时.value = s.default.送金刚启动时间),
                    this.schedule(
                        function() {
                            t.倒计时.emit();
                        },
                        1,
                        cc.macro.REPEAT_FOREVER
                    );
                    var e = p.DatasManager.HeroDatas[1];
                    (this.装备1.value = p.DatasManager.EquipDatasById[e.equipids[0]].iconName),
                    (this.装备2.value = p.DatasManager.EquipDatasById[e.equipids[1]].iconName),
                    (this.装备3.value = p.DatasManager.EquipDatasById[e.equipids[2]].iconName);
                }),
                (e.prototype.onClick = function(t) {
                    var e = this;
                    switch (t) {
                        case "关闭":
                            this.hideView();
                            break;
                        case "免费领取":
                            u.default.show(a.dd.songjingang, function() {
                                if (
                                    ((s.default.送金刚广告次数 += 1),
                                        s.default.送金刚广告次数 >= p.DatasManager.金刚礼包看视频次数)
                                ) {
                                    e.hideView();
                                    var t = p.DatasManager.HeroDatas[1];
                                    s.default.heros.includes(t.ID) ||
                                        (s.default.heros.push(t.ID), (s.default.heros = s.default.heros)),
                                        t.equipids.forEach(function(t) {
                                            e.addequip(p.DatasManager.EquipDatasById[t]);
                                        }),
                                        (s.default.送金刚是否完成 = !0),
                                        e.showView(f.default);
                                }
                            });
                    }
                }),
                (e.prototype.addequip = function(t) {
                    s.default.equips.includes(t.ID) ||
                        (s.default.equips.push(t.ID), (s.default.equips = s.default.equips));
                }),
                (e = r([h], e))
            );
        })(l.default));
o.default = y;